﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BbsbWebService;
using System.Xml.Linq;

namespace BbsbWsGui
{
    public class GuiSettings : AppSettings
    {
        private static GuiSettings _instance;

        public static new GuiSettings Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new GuiSettings();
                    AppSettings.Instance = _instance;
                }
                return _instance;
            }
        }

        public bool Log { get; set; }

        public bool StartServiceOnLoad { get; set; }

        public override void Initialise()
        {
            base.Initialise();
            StartServiceOnLoad = AppSettings.GetItemFromSettings("StartServiceOnLoad", false);
            Log = AppSettings.GetItemFromSettings("Log", false);
        }

        public override IEnumerable<XElement> GetExtraSaveFields()
        {
            yield return new XElement("Log", Log);
            yield return new XElement("StartServiceOnLoad", StartServiceOnLoad);
        }
    }
}
